package com.xy.servicemanage.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.servicemanage.ServiceSpecifications;
import com.xy.servicemanage.service.IServiceSpecificationsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 【请填写服务价格】Controller
 *
 * @author ruoyi
 * @date 2025-06-23
 */
@RestController
@RequestMapping("/specifications")
public class ServiceSpecificationsController extends BaseController
{
    @Autowired
    private IServiceSpecificationsService serviceSpecificationsService;

    /**
     * 查询【请填写服务价格】列表
     */
    @RequiresPermissions("servicemanage:specifications:list")
    @GetMapping("/list")
    public TableDataInfo list(ServiceSpecifications serviceSpecifications)
    {
        startPage();
        List<ServiceSpecifications> list = serviceSpecificationsService.selectServiceSpecificationsList(serviceSpecifications);
        return getDataTable(list);
    }

    /**
     * 导出【请填写服务价格】列表
     */
    @RequiresPermissions("servicemanage:specifications:export")
    @Log(title = "【请填写服务价格】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ServiceSpecifications serviceSpecifications)
    {
        List<ServiceSpecifications> list = serviceSpecificationsService.selectServiceSpecificationsList(serviceSpecifications);
        ExcelUtil<ServiceSpecifications> util = new ExcelUtil<ServiceSpecifications>(ServiceSpecifications.class);
        util.exportExcel(response, list, "【请填写服务价格】数据");
    }

    /**
     * 获取【请填写服务价格】详细信息
     */
    @RequiresPermissions("servicemanage:specifications:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(serviceSpecificationsService.selectServiceSpecificationsById(id));
    }

    /**
     * 新增【请填写服务价格】
     */
    @RequiresPermissions("servicemanage:specifications:add")
    @Log(title = "【请填写服务价格】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ServiceSpecifications serviceSpecifications)
    {
        return toAjax(serviceSpecificationsService.insertServiceSpecifications(serviceSpecifications));
    }

    /**
     * 修改【请填写服务价格】
     */
    @RequiresPermissions("servicemanage:specifications:edit")
    @Log(title = "【请填写服务价格】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ServiceSpecifications serviceSpecifications)
    {
        return toAjax(serviceSpecificationsService.updateServiceSpecifications(serviceSpecifications));
    }

    /**
     * 删除【请填写服务价格】
     */
    @RequiresPermissions("servicemanage:specifications:remove")
    @Log(title = "【请填写服务价格】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(serviceSpecificationsService.deleteServiceSpecificationsByIds(ids));
    }
}

